<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
     let arr = [10,5,3,4,7,2,1];
     let num = 0;
     for (let i = 0;i<arr.length-1;i++){
            for (let m = 0;m<arr.length-i-1;m++){
                 if(arr[m] > arr[m+1]){
                       let num = arr[m];
                       arr[m] = arr[m+1];
                       arr[m+1] = num;
                 }
            }
     }
     console.log(arr);
</script>
</body>
</html>